#include "container_base.hpp"
#include <xml/pugixml.hpp>

ui_container::~ui_container ()
{
    for (auto &x: children_)
    {
        delete x;
        x = nullptr;
    }
}

void ui_container::bind (bindable_base *data)
{
    for (auto &x: children_)
    {
        x->bind(data);
    }
}

void ui_container::init_content (const xml_node &node)
{
    for (auto& child : node)
    {
        if (auto* item = ui_item::create_ui(child, this))
        {
            children_.emplace_back(item);
        }
    }
}
